//
// Created by fengg on 2020/2/25.
//

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

enum Subject {
    math = 0,
    physics,
    foreign,
    language,
    pe
};


class Student {

public:
    string ID;
    double  Sore[5];

    double getAverageSore(){
        double sum=0;
        for (int i = 0; i < 5; ++i) {
            sum += this->Sore[i];
        }
        return sum/5;
    }
    bool isAllSoreAbove(double Sore) {
        int index=0;
        while (index < 5) {
            if (this->Sore[index++] < Sore)
                return false;
        }
        return true;
    }
    bool isGoodOne(){
        return this->getAverageSore() >= 85 || this->isAllSoreAbove(80);
    }
    bool isBadOne(){
        int failureCount = 0;
        for (int i = 0; i < 5; ++i) {
            if(this->Sore[i] < 60)
                failureCount++;
            if(failureCount >= 2)
                return true;
        }
        return false;
    }
};

std::istream& operator>>(std::istream& is, Student* student){
    is  >> student->ID
        >> student->Sore[math]
        >> student->Sore[physics]
        >> student->Sore[foreign]
        >> student->Sore[language]
        >> student->Sore[pe];
    return is;
}

ostream& operator<<(ostream& os,Student* student){
    char blank[] = " ";
    os  << student->ID              << blank
        << student->Sore[math]      << blank
        << student->Sore[physics]   << blank
        << student->Sore[foreign]   << blank
        << student->Sore[language]  << blank
        << student->Sore[pe]        << blank
        << student->getAverageSore() << endl;
    return os;
}

typedef Student* StudentP;

Student* badList[10] = {NULL};
Student* goodList[10] = {NULL};

int main(){
    Student* temp_student;
    double entryMathSore = 0;
    int badListCount=0,goodListCount=0;
    for (int i = 0; i < 10; ++i) {
        temp_student = new Student();
        cin >> temp_student;
        if(temp_student->isGoodOne())
            goodList[goodListCount++] = temp_student;
        else if(temp_student->isBadOne())
            badList[badListCount++] = temp_student;
        entryMathSore += temp_student->Sore[math];
    }
    cout << fixed;
    cout << setprecision(2);
    cout << entryMathSore/10 << endl;
    for (int j = 0; badList[j]!= NULL && j < 10; ++j) {
        cout << badList[j];
    }
    for (int j = 0; goodList[j]!= NULL && j < 10; ++j) {
        cout << goodList[j];
    }

    return 0;
}
